﻿
@{
    var elementId = MenuItem.ElementId ?? "MenuItem_" + MenuItem.Name.Replace(".", "_");
    var cssClass = string.IsNullOrEmpty(MenuItem.CssClass) ? string.Empty : MenuItem.CssClass;
    var disabled = MenuItem.IsDisabled ? "disabled" : string.Empty;
    var url = MenuItem.Url == null ? "#" : MenuItem.Url.TrimStart('/', '~');
}
@if (MenuItem.IsLeaf)
{
    if (MenuItem.Url != null)
    {
        <MenuItem Key="@elementId" RouterLink="@url">
        @if (MenuItem.Icon != null)
        {
            <Icon Type="@MenuItem.Icon" Theme="outline"/>
        }
    
        <span>@MenuItem.DisplayName</span>
                                   </MenuItem>
    }
}
else
{
    <SubMenu Key="@elementId" Title=@MenuItem.Name>
        @foreach (var childMenuItem in MenuItem.Items)
        {
            <SecondLevelNavMenuItem MenuItem="childMenuItem"/>
        }
    </SubMenu>
}
@code {
}
